<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="keywords" content="广东国防教育学会">
    <meta name="description" content="广东国防教育学会">
    <title>广东国防教育学会</title>
    <link rel="shortcut icon" href="/Public/Admin/img/favicon.ico">
    <link href="/Public/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="/Public/Admin/bootstrap_validator-0.4.5/dist/css/bootstrapValidator.css"/>
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Admin/plugins/iCheck/all.css" rel="stylesheet">
    <style>
		/* *{
			color:#000;
		} */
		.btn{
		 	 padding: 5px 8px;
		 	 /* border-radius: 0px; */
			font-size:12px;
			margin-bottom:0px;
		}
		.table{
	    	width: 100%;
		}
		.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
			padding:0px 5px;
			/*text-align: center;*/
			vertical-align: middle!important;
		}
		.form-control{
			font-size: 12px;
		}
		#file-pretty button{
			padding: 7.5px 13px;
		}
		p{
	   		 margin: 0 0;
		}
		.pagination{
			margin:0px 0px;
		}
		.select_width{
			width:100px;
		}
		.select_no_border{
			border-right: none;
		}
	</style>
</head>
 <link rel="stylesheet" href="/Public/Admin/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css" media="screen"/>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <?php if($act == 'add'): ?><h5>添加广告</h5>
                    	<?php else: ?>
                    		<h5>修改广告</h5><?php endif; ?>
                            <button onclick="history.go(-1);" style="margin-top: -6px;" class="btn btn-primary pull-right"><i class="fa fa-arrow-left"></i> 返回</button>
                    </div>
                    <div class="ibox-content">
                        <form action="/Admin/Advert/addAdvert" method="post" class="form-horizontal" id="defaultForm" enctype="multipart/form-data">
                        	<div class="form-group">
                                <label class="col-sm-2 control-label">广告位置</label>
                                <div class="col-sm-6">
                                    <select name="position_id" class="form-control">
                                    	<option value="">请选择</option>
										<?php if(is_array($position)): foreach($position as $k=>$position): ?><option <?php if($position['id'] == $advert['position_id']): ?>selected<?php endif; ?> value="<?php echo ($position['id']); ?>"><?php echo ($position['name']); ?></option><?php endforeach; endif; ?>
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        
                        	 <!-- <div class="form-group">
                                <label class="col-sm-2 control-label">媒介类型</label>
                                <div class="col-sm-6">
                                    <select name="category" class="form-control">
                                    <?php if(is_array($category)): foreach($category as $k=>$category): ?><option <?php if($advert['category'] == $category['id']): ?>selected<?php endif; ?> value="<?php echo ($category['id']); ?>"><?php echo ($category['name']); ?></option><?php endforeach; endif; ?>
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div> -->
                        
                           <div class="form-group">
                                <label class="col-sm-2 control-label">广告名称</label>
                                <div class="col-sm-6">
                                    <input type="text" name="name" value="<?php echo ($advert['name']); ?>" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                             
                            <div class="form-group" id="trial_status_group">
                            <label class="col-sm-2 control-label">媒介类型</label>
                            <div class="i-check col-sm-6" style="line-height: 30px;">
                            <input type="radio" name="media_type" value="1" <?php if(($advert['media_type'] == 1) or ($advert['media_type'] == '')): ?>checked="checked"<?php endif; ?> />
                          	 图片&nbsp;
                           	<input type="radio" name="media_type" value="2" <?php if($advert['media_type'] == 2): ?>checked="checked"<?php endif; ?>/>
                           	 文字&nbsp;
                            </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group reason_class" <?php if($advert['media_type'] != 2): ?>style="display:none;"<?php endif; ?>>
                                <label class="col-sm-2 control-label">广告内容</label>
                                <div class="col-sm-6">
                                    <textarea name="code" placeholder="请输入广告内容" rows="5" class="form-control"><?php echo ($advert['reason']); ?></textarea>
                                    <!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请输入不通过原因</span> -->
                                </div>
                            </div>
                            <div class="hr-line-dashed reason_class" <?php if($advert['media_type'] != 2): ?>style="display:none;"<?php endif; ?>></div>
                            
                           <div class="form-group advert_img_class">
                                <label class="col-sm-2 control-label">广告图片</label>
                                <div class="col-sm-6">
                                    <div id="file-pretty">
                                            <input type="file" name="advert_img" class="form-control">
                                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 温馨提示：图片尺寸建议为：900*525，图片小于4M</span>
                                        <!-- <div class="form-group">
                                            <label class="font-noraml">文件选择（多选）</label>
                                            <input type="file" multiple="multiple" class="form-control">
                                        </div> -->
                                         <?php if($advert['advert_img']): ?><a target="_blank" href="<?php echo ($advert["advert_img"]); ?>"><i class="fa fa-image fa-2x"></i></a>
                                             <input type="hidden" name="old_advert_img" value="<?php echo ($advert["advert_img"]); ?>" /><?php endif; ?> 
									
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed advert_img_class"></div>
                            
                            <div class="form-group form-inline" >
                             <label class="col-sm-2 control-label">广告时间</label>
                                <div class="col-sm-8">
                                   <div class="col-sm-4 input-group date" id="datetimepicker6">
						                <input type="text" name="start_time" value="<?php echo ($advert['start_time'] ? $advert['start_time'] : '2017-07-01 08:00'); ?>" class="form-control">
						                <!-- <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span> -->
						                <span class="input-group-addon">
						                    <span class="fa fa-calendar"></span>
						                </span>
						            </div>
						            
						            <div class="col-sm-4 input-group date" id="datetimepicker7">
						                <input type="text" name="end_time" value="<?php echo ($advert['end_time'] ? $advert['end_time'] : '2017-07-02 08:00'); ?>" class="form-control">
						                <!-- <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span> -->
						                <span class="input-group-addon">
						                    <span class="fa fa-calendar"></span>
						                </span>
						            </div>
                              </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告链接</label>
                                <div class="col-sm-6">
                                    <input type="text" name="link" value="<?php echo ($advert['link']); ?>" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                             <div class="form-group">
                                <label class="col-sm-2 control-label">广告联系人</label>
                                <div class="col-sm-6">
                                    <input type="text" name="link_man" value="<?php echo ($advert['link_man']); ?>" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告联系人邮箱</label>
                                <div class="col-sm-6">
                                    <input type="text" name="link_email" value="<?php echo ($advert['link_email']); ?>" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告联系人电话</label>
                                <div class="col-sm-6">
                                    <input type="text" name="link_phone" value="<?php echo ($advert['link_phone']); ?>" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">排序</label>
                                <div class="col-sm-6">
                                    <input type="number" name="sort" value="<?php echo ($advert['sort']); ?>" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">是否显示</label>
                                <div class="i-check col-sm-6" style="line-height: 30px;">
                                <input type="radio"  name="enabled" value="1"  <?php if(($advert['enabled'] == 1) or ($advert['enabled'] == '')): ?>checked="checked"<?php endif; ?> />
                              	  是&nbsp;
                                <input type="radio" name="enabled" value="2" <?php if($advert['enabled'] == 2): ?>checked="checked"<?php endif; ?>/>
                               	 否&nbsp;
                            </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                           
                            
                            
                            <input type="hidden" name="act" value="<?php echo ($act); ?>" />
                            <input type="hidden" name="id" value="<?php echo ($id); ?>" />
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <button class="btn btn-white" type="submit">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
				</div>
			</div>
		</div>
	</div>


	
<script src="/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
<!-- <script src="/Public/Admin/js/content.min.js?v=1.0.0"></script> -->
<script type="text/javascript" src="/Public/Admin/bootstrap_validator-0.4.5/dist/js/bootstrapValidator.js"></script>
<script src="/Public/Admin/plugins/layer/layer.js"></script>
<script src="/Public/Admin/plugins/iCheck/icheck.min.js"></script>

<script>
//设置checkbox按钮
$('.i-check').iCheck({
	checkboxClass : "icheckbox_square-green",
	radioClass : "iradio_square-green",
});
</script>

</body>
</html>
<!-- 	 <script src="/Public/Home/js/region_select.js"></script>
      <script type="text/javascript">
                new PCAS('province', 'city', 'area', '<?php echo ($advert['province']?$advert['province']:'广东省'); ?>', '<?php echo ($advert['city']?$advert['city']:'广州市'); ?>', '<?php echo ($advert['area']?$advert['area']:'天河区'); ?>');
     </script>
	<script src="/Public/ueditor/ueditor.config.js" type="text/javascript"></script>
    <script src="/Public/ueditor/ueditor.all.js" type="text/javascript"></script> -->

<script>
          // UE.getEditor('editor');
           /* UE.getEditor('editor', {
               theme:"default", //皮肤
               lang:'zh-cn', //语言
               serverUrl: '/server/ueditor/controller.php'
           }); */

          /*UE.getEditor('editor');
            UE.getEditor('requirement');
            UE.getEditor('prize_set'); */
 </script>   

	<script>
$(document).ready(function() {
	
    /**
     * 下面是进行插件初始化
     * 你只需传入相应的键值对
     * */
    $('#defaultForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {/*输入框不同状态，显示图片的样式*/
            	  valid: 'glyphicon glyphicon-ok',
                  invalid: 'glyphicon glyphicon-remove',
                  validating: 'glyphicon glyphicon-refresh'
            },
            fields: {/*验证*/
            	name: {/*键名username和input name值对应*/
                    message: '广告名称验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '广告名称不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 2,
                            max: 100,
                            message: '广告名称长度必须在2到100之间'
                        }/*最后一个没有逗号*/
                    }
                },
                position_id: {/*键名username和input name值对应*/
                    message: '广告位置验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '广告位置不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 1,
                            max: 30,
                            message: '广告位置长度必须在1到30之间'
                        }/*最后一个没有逗号*/
                    }
                }
               
            }
            // 还有一个比较常用的就是submitHandler属性，它对应着提交按钮的事件方法。
            // submitHandler: function (validator, form, submitButton) {
                //alert("submit");
               /*  var menu_name = $("input[name='menu_name']").val();
                var link = $("input[name='link']").val();
                var ico = $("input[name='ico']").val();
                $.ajax({
                    url : '/Admin/Advert/addMenu',
                    type : 'get',
                    data : {'menu_name' : menu_name, 'link' : link, 'ico':ico},
                    dataType : 'json',
                    success : function(data){
                      alert(data.message);
                    }
                }); */
           // }
        });
});

</script>

<script type="text/javascript" src="/Public/Admin/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="/Public/Admin/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

<script type="text/javascript">

        $('#datetimepicker6').datetimepicker({
             language:  'zh-CN',
             format: 'yyyy-mm-dd HH:ii',
             autoclose:true,//日期选择完成后是否关闭选择框
        });
        $('#datetimepicker7').datetimepicker({
            language:  'zh-CN',
            format: 'yyyy-mm-dd HH:ii',
            autoclose:true //Important! See issue #1075
        });
</script>

 <script src="/Public/Admin/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
 <script type="text/javascript">
 $(function(){
    $('#file-pretty input[type="file"]').prettyFile();
    $('.input-large').val('<?php echo ($advert['advert_img']); ?>');
 });

 //修改菜单
function lookImg(){
    $('#myModal').modal('show');
}

$("#trial_status_group .iCheck-helper").click(function(){
	if($(this).siblings("input").val() == 2){
		$(".advert_img_class").hide();
		$(".reason_class").show();
	}else{
		$(".reason_class").hide();
		$(".advert_img_class").show();
	}
});
 </script>

       
</body>
</html>